/**
 * 
 */
package com.roc.util.constant;

import org.apache.commons.lang3.StringUtils;

/**
 * @author 返回码
 */
public enum RespCode {
     
	 RESP_CODE_9999("交易失败", "9999"),
	 RESP_CODE_01("交易成功","00"),                          
	 RESP_CODE_02("请持卡人与发卡银行联系","01"),             
	 RESP_CODE_03("无效商户","03"),                           
	 RESP_CODE_04("此卡被没收","04"),                         
	 RESP_CODE_05("持卡人认证失败","05"),                     
	 RESP_CODE_10("显示部分批准金额，提示操作员","10"),       
	 RESP_CODE_11("交易成功","11"),                      
	 RESP_CODE_12("无效交易","12"),                           
	 RESP_CODE_13("无效金额","13"),                           
	 RESP_CODE_14("无效卡号","14"),                           
	 RESP_CODE_15("此卡无对应发卡方","15"),                   
	 RESP_CODE_21("该卡未初始化或睡眠卡","21"),               
	 RESP_CODE_22("操作有误，或超出交易允许天数","22"),       
	 RESP_CODE_25("没有原始交易，请联系发卡方","25"),         
	 RESP_CODE_30("请重试","30"),                             
	 RESP_CODE_34("作弊卡,呑卡","34"),                        
	 RESP_CODE_38("密码错误次数超限，请与发卡方联系","38"),   
	 RESP_CODE_40("发卡方不支持的交易类型","40"),             
	 RESP_CODE_41("挂失卡，请没收（POS）","41"),              
	 RESP_CODE_43("被窃卡，请没收","43"),                     
	 RESP_CODE_51("可用余额不足","51"),                       
	 RESP_CODE_54("该卡已过期","54"),                         
	 RESP_CODE_55("密码错 ","55"),                            
	 RESP_CODE_57("不允许此卡交易","57"),                     
	 RESP_CODE_58("发卡方不允许该卡在本终端进行此交易","58"), 
	 RESP_CODE_59("卡片校验错","59"),                         
	 RESP_CODE_61("交易金额超限","61"),                       
	 RESP_CODE_62("受限制的卡","62"),                         
	 RESP_CODE_64("交易金额与原交易不匹配","64"),             
	 RESP_CODE_65("超出消费次数限制","65"),                   
	 RESP_CODE_68("交易超时，请重试","68"),                   
	 RESP_CODE_75("密码错误次数超限","75"),                   
	 RESP_CODE_90("系统日切，请稍后重试","90"),               
	 RESP_CODE_91("发卡方状态不正常，请稍后重试","91"),       
	 RESP_CODE_92("发卡方线路异常，请稍后重试","92"),         
	 RESP_CODE_94("拒绝，重复交易，请稍后重试","94"),         
	 RESP_CODE_96("系统异常","96"),     
	 RESP_CODE_97("终端未登记","97"),                         
	 RESP_CODE_98("发卡方超时","98"),                         
	 RESP_CODE_99("PIN格式错，请重新签到","99"),              
	 RESP_CODE_A0("MAC校验错，请重新签到","A0"),              
	 RESP_CODE_A1("转账货币不一致","A1"),                     
	 RESP_CODE_A2("交易成功，请向发卡行确认","A2"),           
	 RESP_CODE_A3("账户不正确","A3"),                         
	 RESP_CODE_A4("交易成功，请向发卡行确认","A4"),           
	 RESP_CODE_A5("交易成功，请向发卡行确认","A5"),           
	 RESP_CODE_A6("交易成功，请向发卡行确认","A6"),           
	 RESP_CODE_A7("拒绝，交换中心异常，请稍后重试","A7"),
	 RESP_CODE_AB("请重新下载主密钥","AB"),
	 RESP_CODE_OT("交易金额太小","OT"),//OT
	 RESP_CODE_TIMEOUT("交易超时",""),//OT

	 RESP_CODE_F1("密码错次数超限","F1"),
	 RESP_CODE_F2("余额不足次数超限","F2"),
	 RESP_CODE_F3("查询余额次数超限","F3"),
	 RESP_CODE_F4("拒绝交易","F4"),
	 RESP_CODE_F5("单笔交易金额超限","F5"),
	 RESP_CODE_F6("终端交易金额超限","F6"),
	 RESP_CODE_F7("商户交易金额超限","F7"),
	 RESP_CODE_F8("消费笔数超限","F8"),
	 RESP_CODE_F9("累计消费超限","F9"),
	 RESP_CODE_F0("刷卡笔数超限","F0"),
	 RESP_CODE_S0("不支持的卡BIN","S0"),
	 RESP_CODE_S1("交易金额太小","S1"),
	 RESP_CODE_S2("请更新应用程序","S2"),
	 RESP_CODE_S3("交易过于频繁","S3"),
	 RESP_CODE_S4("月累计消费金额超限","S4"),
	 RESP_CODE_S5("S5","S5"),
	 RESP_CODE_S6("S6","S6"),
	 RESP_CODE_S7("S7","S7"),
	 RESP_CODE_S8("S8","S8"),
	 RESP_CODE_S9("S9","S9");
	 
	 
	private String code;
	private String name;

	private RespCode( String name,String code) {
		this.code = code;
		this.name = name;
		
	}


	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public static RespCode valueOfCode(String code) {
		if (StringUtils.isBlank(code)) {
			throw new IllegalArgumentException("RespCode code " + code
					+ " is blank");
		}
		for (RespCode ms : values()) {
			if (ms.getCode().equals(code)) {
				return ms;
			}
		}
		throw new IllegalArgumentException("RespCode code " + code
				+ " is not exist");
	}

}
